package com.app.common;

import com.app.utils.UtilTools;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * Copyright (C) @2020 fgwang.660@gmail.com
 *
 * @author witt
 * @version 1.1
 * @className POJO
 * @date 2020-05-31 18:59
 * @description POJO基础类
 */
public class POJO implements Serializable {
	private static final long serialVersionUID = 5149949343238900304L;

	// 主键id
	private Integer id;

	// 创建时间
	private LocalDateTime createdTime;

	// 更新时间
	private LocalDateTime updateTime;

	// 数据有效标识 (true 无效， false - 有效)
	private Boolean disable = false;

	public Integer getId() {
		return id;
	}

	public POJO setId(Integer id) {
		this.id = id;
		return this;
	}

	public LocalDateTime getCreatedTime() {
		return createdTime;
	}

	public POJO setCreatedTime(LocalDateTime createdTime) {
		this.createdTime = UtilTools.isEmpty(createdTime) ? LocalDateTime.now() : createdTime;
		return this;
	}

	public LocalDateTime getUpdateTime() {
		return updateTime;
	}

	public POJO setUpdateTime(LocalDateTime updateTime) {
		this.updateTime = UtilTools.isEmpty(updateTime) ? LocalDateTime.now() : updateTime;
		return this;
	}

	public Boolean getDisable() {
		// 避免空指针
		return UtilTools.isEmpty(disable) ? false : disable;
	}

	public POJO setDisable(Boolean disable) {
		this.disable = disable;
		return this;
	}
}
